#include <stdio.h>

#include "wifi_connect.h"
#include "wifi_connecter.h"
#include "wifi_starter.h"
#include "wifi_config.h"

uint32_t WifiConnect(void)
{
    
    WifiDeviceConfig apConfig = {0};
    strcpy_s(apConfig.ssid, sizeof(apConfig.ssid), CONFIG_WIFI_SSID);
    strcpy_s(apConfig.preSharedKey, sizeof(apConfig.preSharedKey), CONFIG_WIFI_PWD);
    apConfig.securityType = WIFI_SEC_TYPE_PSK;

    int netId = ConnectToHotspot(&apConfig);
}

uint32_t WifiHotspot(void)
{
    WifiErrorCode errCode;
    HotspotConfig config = {0};

    strcpy_s(config.ssid, sizeof(config.ssid), "HiSpark-AP");
    strcpy_s(config.preSharedKey, sizeof(config.preSharedKey), "12345678");
    config.securityType = WIFI_SEC_TYPE_PSK;
    config.band = HOTSPOT_BAND_TYPE_2G;
    config.channelNum = 7;

    osDelay(10);

    printf("starting AP ...\r\n");
    errCode = StartHotspot(&config);
    printf("StartHotspot: %d\r\n", errCode);
}
